<%--
  Created by IntelliJ IDEA.
  User: HUAWEI
  Date: 2024/9/3
  Time: 10:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Medicamp Responsive Bootstrap Template">
    <meta name="keywords" content="Pixel">
    <meta name="author" content="rkwebdesigns">
    <title>个人中心</title>
    <link href="${pageContext.request.contextPath}/static/css/bootstrap.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/css/bootstrap-dropdownhover.min.css" rel="stylesheet">
    <!-- Fonts Awesome -->
    <link href="${pageContext.request.contextPath}/static/css/font-awesome.min.css" rel="stylesheet">
    <!-- Google Fonts -->
    <link href='https://fonts.googleapis.com/css?family=Raleway:400,200,300,100,500,600,700,800,900' rel='stylesheet' type='text/css'>
    <link href="https://fonts.googleapis.com/css?family=Poppins:300,400" rel="stylesheet">
    <!-- animate Effect -->
    <link href="${pageContext.request.contextPath}/static/css/animate.css" rel="stylesheet">
    <!-- Main CSS -->
    <link href="${pageContext.request.contextPath}/static/css/style.css" rel="stylesheet">
    <!-- Responsive CSS -->
    <link href="${pageContext.request.contextPath}/static/css/responsive.css" rel="stylesheet">
    <style>
        .form-container {
            background-color: rgba(255, 255, 255, 0.8); /* 半透明背景颜色 */
            /*background-color: #ffffff; !* 白色背景 *!*/
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            padding: 20px;
            width: 100%;
            height: 100%;
            max-width: 700px; /* 最大宽度 */
            max-height: 700px;
            display: flex;
            flex-direction: column;
        }
        h2 {
            text-align: center;
            color: #007bff; /* 蓝色 */
        }
        .form-group {
            margin-bottom: 15px;
        }
        .form-group label {
            display: block;
            margin-bottom: 5px;
            color: #333;
        }
        .form-group input, .form-group select {
            width: 100%;
            padding: 8px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        .form-group input[type="file"] {
            padding: 0;
        }
        .form-group button {
            width: 30%;
            padding: 10px;
            background-color: #007bff; /* 蓝色 */
            border: none;
            color: #fff;
            border-radius: 4px;
            cursor: pointer;
        }
        .form-group button:hover {
            background-color: #0056b3; /* 深蓝色 */
        }
        body {
            background: url('${pageContext.request.contextPath}/static/img/blog/blog-2.jpg') no-repeat center center fixed;
            background-size: cover;
            margin: 0;
            height: 100vh;
            width: 100vw;
        }
    </style>

</head>
<body>
<center>
    <div class="form-container">
        <h2>修改密码</h2>
        <form class="transparent-form" id="f1" action="${pageContext.request.contextPath}/adminInfo/updateInfo.do" method="post">
            <input type="hidden" name="id" id="id" value="${admin.id}">
            <div class="form-group">
                <label for="username">用户名</label>
                <input type="text" id="username" name="username" value="${admin.username}" readonly>
                <span id="s1"></span>
            </div>
            <div class="form-group">
                <label>旧密码</label>
                <input type="text" id="oldPwd" value="${admin.password}" readonly>
            </div>
            <div class="form-group">
                <label for="password">新密码</label>
                <input type="password" id="password" name="password">
                <span id="s2"></span><br/>
            </div>
            <div class="form-group">
                <label for="password">确认密码</label>
                <input type="password" id="repassword" name="repassword">
                <span id="s3"></span><br/>
            </div>

            <div class="form-group">
                <button type="submit">保存</button>
                <button type="reset" onclick="goBack()">取消</button>
            </div>
        </form>
    </div>
</center>

</body>
<script src="../static/js/jquery.min.js"></script>
<script src="../static/js/bootstrap.min.js"></script>
<script src="../static/js/jquery.plugin.min.js"></script>
<script src="../static/js/jquery.isotope.min.js"></script>
<script src="../static/js/jquery.magnific-popup.min.js"></script>
<script src="../static/js/bootstrap-dropdownhover.min.js"></script>
<script src="../static/js/wow.min.js"></script>
<script src="../static/js/waypoints.min.js"></script>
<script src="../static/js/jquery.counterup.min.js"></script>
<script src="../static/js/main.js"></script>
<script>
    var flag2=false
    var flag3=false

    $("#password").blur(function () {
        var password = $(this).val();
        var oldPwd = $("#oldPwd").val();
        if (password == null || password.trim() == "") {
            $("#s2").text("密码不能为空")
            flag2=false
        }else {
            if (password.length < 6) {
                $("#s2").text("密码不能少于六位")
                flag2=false
            }else {
                if (oldPwd==password) {
                    $("#s2").text("与新密码不能一致！")
                }else {
                    $("#s2").text("√")
                    flag2=true
                }
            }
        }
    })
    $("#repassword").blur(function () {
        var repassword = $(this).val();
        var password = $("#password").val();
        if (repassword == null || repassword.trim() == "") {
            $("#s3").text("密码不能为空")
            flag3=false
        }else {
            if (repassword==password){
                $("#s3").text("√")
                flag3=true
            } else {
                $("#s3").text("两次密码不一致")
                flag3=false
            }
        }
    })
    $("#f1").submit(function () {
        if (flag2 && flag3) {
            return true
        }else {
            alert("您输入的信息有误，请重新输入！")
            return false
        }
    })
    function goBack() {
        window.history.back();
    }
</script>
</html>
